home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / PM2.C < prev    next >
C/C++ Source or Header  |  1993-05-18  |  3KB  |  105 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville, MI
  3. Date: 05-15-93 (17:07)             Number: 130
  4. From: DANNY MATHEWS                Refer#: NONE
  5.   To: ALL                           Recvd: NO  
  6. Subj: <string.h>   2/2               Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. /* #include <string.h>   */
  11.  
  12. FILE    *fin;                             /* log file for misti data    */
  13.  
  14. char    date[9] = "93/05/13";
  15. char    time[9] = "04:30:20";
  16.  
  17. long    ddate = 0;
  18. long    pm_ddate = 0;
  19.  
  20.  
  21. /*------------------------------------------------------------------
  22. **    function prototypes
  23. */
  24.  
  25. int main(void);
  26.  
  27. void grp_data(void);                      /* group data for output      */
  28.  
  29. /*------------------------------------------------------------------
  30. **    function declarations
  31. */
  32.  
  33. void grp_data()
  34. {
  35.       FILE    *fin;                       /* misti data file            */
  36.       FILE    *fout;                      /* data output file           */
  37.       FILE    *fmod;                      /* module data file           */
  38.       FILE    *flog;                      /* log file                   */
  39.  
  40.       int     r;
  41.       int     len;
  42.  
  43.       char    entity[9] = "";
  44.       char    pm_date[8] = "";
  45.       char    mach[9] = "";
  46.       char    state[6] = "";
  47.       char    pm[14] = "";
  48.       char    descript[31] = "";
  49.       char    target[31] = "";
  50.  
  51.       if ((fin = fopen("misti.dat","r")) == NULL)  {
  52.             fprintf(stderr, "Cannot open MISTI.DAT file.\n");
  53.             exit(1);
  54.       }
  55.       fout = fopen("pm.rpt","w");
  56.       fmod = fopen("module.dat","r");
  57.       flog = fopen("error.log","w");
  58.  
  59.       while (!feof(fin))  {                      /* get machine data */
  60.             fscanf(fin,"%6s %5s %7s %12s",entity,state,pm_date,pm);
  61.  
  62.             rewind(fmod);
  63.             r = 1;
  64.  
  65.             while (( r !=0 ) && (!feof(fmod))){  /* get machine description */
  66.  
  67.                   fscanf(fmod,"%6s ",mach);
  68.                   fgets(descript,30,fmod);
  69.  
  70.                   r = strcmp(entity,mach);       /* was it in the list */
  71.  
  72.                   if (r == 0)  {                 /* if so, write to report */
  73.                         len = strxfrm(target,descript,30);
  74.                         strxfrm(target,descript,len);
  75.                         fprintf(fout," %-7s %-25s %5s     %-13s %7s"
  76.                               ,mach,target,state,pm,pm_date);
  77.                         fprintf(fout,"\n");
  78.                   }
  79.             }   /* end while fmod */
  80.       }   /* end while fin */
  81.  
  82.       fclose(fin);
  83.       fclose(fout);
  84.       fclose(fmod);
  85.       fclose(flog);
  86. }    /*  end grp_data  */
  87.  
  88. /*------------------------------------------------------------------
  89. **    main function
  90. */
  91.  
  92. int main(void)
  93. {
  94.       grp_data();
  95.       return(0);
  96. }    /*  end main  */
  97.  
  98. ... OFFLINE 1.52  "For fresh breath and white teeth brush with `PENTIUM'"
  99.  
  100. --- Maximus 2.01wb
  101.  * Origin: The MOCHINE BBS * Irving, TX * 214/399-8414 * HST DS *  (1:124/1301)
  102. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  103. SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 261/1023
  104. SEEN-BY: 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  105.